package com.itheima.controller;

import com.itheima.pojo.OperateLog;
import com.itheima.pojo.PageResult;
import com.itheima.pojo.Result;
import com.itheima.service.LogService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RequestMapping("/log/page")
@RestController
public class LogController {

    @Autowired
    private LogService logService;

    @GetMapping()
    public Result LogPage(
            @RequestParam(defaultValue = "1") Integer page,        // 当前页，默认第1页
            @RequestParam(defaultValue = "10") Integer pageSize     // 每页条数，默认10条
    ) {
        PageResult<OperateLog> pageResult = logService.LogPage(page,pageSize);
        log.info("分页查询操作日志");
        return Result.success(pageResult);
    }
}
